//
//  FHDiscoverSearchView.swift
//  WeiBo
//
//  Created by qfh on 16/7/12.
//  Copyright © 2016年 qiufuhe. All rights reserved.
//

import UIKit

class FHDiscoverSearchView: UIView, UITextFieldDelegate {

    @IBOutlet weak var textField: UITextField!
    
    
    @IBOutlet weak var contenButton: UIButton!
    @IBOutlet weak var textFieldRight: NSLayoutConstraint!
    
    func textFieldDidBeginEditing(textField: UITextField) {
        
        textFieldRight.constant =  contenButton.width
        
        UIView.animateWithDuration(1.0) { () -> Void in
            self.layoutIfNeeded()
        }
        
    }

    
    @IBAction func dismisAction(sender: AnyObject) {
        
        textField.resignFirstResponder()
        
        textFieldRight.constant =  0
        
        UIView.animateWithDuration(1.0) { () -> Void in
            self.layoutIfNeeded()
        }
        
        
        
    }
    
    class func discovierSerchView() ->FHDiscoverSearchView {
        
        return UINib(nibName: "FHDiscoverSearchView", bundle: nil).instantiateWithOwner(nil, options: nil).last as! FHDiscoverSearchView
        
        
    }

}
